package com.lzn.dds.service.impl;

import com.alibaba.druid.pool.DruidDataSource;
import com.lzn.dds.dataSource.DBIdentifier;
import com.lzn.dds.dataSource.DynamicDataSource;
import com.lzn.dds.entity.DbSource;
import com.lzn.dds.service.DruidService;

import java.sql.Connection;

/**
 * @author lzn
 * @date 6/10/21 9:59 PM
 */
public class DruidServiceImpl implements DruidService {
    @Override
    public Connection getConnection(String taskId) {
        DbSource dbSource = mapper.selectByTaskid(taskId);
        DBIdentifier.setProjectCode(dbSource.getDdsId());
        return DynamicDataSource.instance().getConnection();
    }
}
